package top.cross.webapp.common.view;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import top.cross.webapp.common.R;

public class ZProgressDialog extends Dialog {

    private ZProgressDialog(Context context, int theme) {
        super(context, theme);
    }

    public static ZProgressDialog createProgressDialog(Context context,
                                                       String message) {
        ZProgressDialog progress = new ZProgressDialog(context, R.style.dialog);
        progress.requestWindowFeature(Window.FEATURE_NO_TITLE);

        View view = LayoutInflater.from(context).inflate(
                R.layout.progress_dialog, null);
        TextView tvMessage = (TextView) view.findViewById(R.id.message);
        tvMessage.setText(message);
        progress.setContentView(view);
        progress.setCanceledOnTouchOutside(false);
        return progress;
    }
}
